<template>
  <div>
    <div class="top_Dropdo"></div>
    <div>
      <div v-if="loading">Loading...</div>
      <!-- 判断状态为空时展示 -->
      <div v-else-if="true">
        <van-empty description="无可用数据">
          <van-button class="btn">健康科普</van-button>
          <van-button class="btn" @click="zhuan">咨询专家</van-button>
          <van-button class="btn" @click="gua">医院挂号</van-button>
          <van-button class="btn">线上购药</van-button>
          <span @click="feedback" class="feedback">我要反馈</span>
        </van-empty>
      </div>
      <!-- 数据不为空时展示 -->
      <div v-else>123</div>
    </div>
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
// import axios from 'axios';
const data = ref([]);
const loading = ref(true);
const router = useRouter();
// 判断是否存在后端数据如果有xaios传到前端
onMounted(async () => {
  try {
    // const response = await axios.get('https://api.example.com/data');
    // data.value = response.data;
  } catch (error) {
    console.error('Error fetching data:', error);
  } finally {
    loading.value = false;
  }
});

const Xiang = () => {
  console.log(111);
};
// 医院挂号
const gua = () => {
  router.push('/layout/appointment');
};
// 咨询专家
const zhuan = () => {
  router.push('/layout/popular');
};
</script>

<style scoped>
.list-item {
  width: 90%;
  height: 18vh;
  background: #d2e9eb;
  border-radius: 10px;
}

.btn {
  width: 80px;
  height: 30px;
  float: left;
  border: none;
  border: 1px solid blue;
  color: blue;
  border-radius: 10px;
  font-size: 12px;
  margin-left: 5px;
}

.feedback {
  color: blue;
  font-size: 14px;
  border-bottom: 2px solid blue;
  position: absolute;
  top: 80%;
  left: 42%;
}

.listTab2 {
  text-align: center;
}
</style>